package com.hmall.feign.interceptor;

import com.hmall.feign.context.UserIdContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;

public class AddHeaderIntercepter implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        Long userId = UserIdContext.getUserId();
        if (userId==null){
            return;
        }
        requestTemplate.header("authorization",userId.toString());
    }
}
